package vn.edu.hcmut.cse.ai.search.problems.waterjug;

import vn.edu.hcmut.cse.ai.search.local.HeuristicFunction;

public class WaterJugFirstHeuristicFunction implements HeuristicFunction{

    /**
     *  Calculate the distance between the current state and the goal stating 
     * by counting the different cells.
     * @param currentState  The current state
     * @param goalState The goal state
     * @return  The distance between the current state and the goal state
     */
    @Override
    public double heuristicEvaluation(Object currentState, Object goalState) {
        WaterState state = (WaterState) currentState;
        WaterState goal = (WaterState) goalState;
        
        int currentJug1 = state.getJug1();
        int currentJug2 = state.getJug2();
        int goalJug1 = goal.getJug1();
        int goalJug2 = goal.getJug2();
        
        int distancePoint = 0;
        distancePoint = Math.abs(currentJug1-goalJug1);
        return (double) distancePoint;
    }
    
}
